using System;
using System.Collections.Generic;
using AutoStopData.Model;

namespace AutostopDataAccess.Domains
{
    public abstract class DomainBase<TEntity> where TEntity : IObjectWithChangeTracker
    {
        protected abstract Dictionary<String, TEntity> LoadFromDatabase();

        private static Dictionary<String, TEntity> data;

        protected Dictionary<String, TEntity> CurrentData()
        {
            if (data == null)
            {
                data = LoadFromDatabase();
            }
            return data;
        }
    }
}